home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 March / PCWMAR09.iso / Software / Freeware / Adobe Media Player 1.6 / adobe_media_player.air / AMP.swf / scripts / mx / containers / Panel.as < prev    next >
Encoding:
Text File  |  2008-11-25  |  33.7 KB  |  979 lines

  1. package mx.containers
  2. {
  3.    import flash.display.DisplayObject;
  4.    import flash.display.Graphics;
  5.    import flash.events.Event;
  6.    import flash.events.MouseEvent;
  7.    import flash.geom.Rectangle;
  8.    import flash.text.TextLineMetrics;
  9.    import flash.utils.getQualifiedClassName;
  10.    import mx.automation.IAutomationObject;
  11.    import mx.containers.utilityClasses.BoxLayout;
  12.    import mx.containers.utilityClasses.CanvasLayout;
  13.    import mx.containers.utilityClasses.ConstraintColumn;
  14.    import mx.containers.utilityClasses.ConstraintRow;
  15.    import mx.containers.utilityClasses.IConstraintLayout;
  16.    import mx.containers.utilityClasses.Layout;
  17.    import mx.controls.Button;
  18.    import mx.core.Container;
  19.    import mx.core.ContainerLayout;
  20.    import mx.core.EdgeMetrics;
  21.    import mx.core.EventPriority;
  22.    import mx.core.FlexVersion;
  23.    import mx.core.IFlexDisplayObject;
  24.    import mx.core.IFlexModuleFactory;
  25.    import mx.core.IFontContextComponent;
  26.    import mx.core.IUIComponent;
  27.    import mx.core.IUITextField;
  28.    import mx.core.UIComponent;
  29.    import mx.core.UIComponentCachePolicy;
  30.    import mx.core.UITextField;
  31.    import mx.core.UITextFormat;
  32.    import mx.core.mx_internal;
  33.    import mx.effects.EffectManager;
  34.    import mx.events.CloseEvent;
  35.    import mx.events.SandboxMouseEvent;
  36.    import mx.styles.ISimpleStyleClient;
  37.    import mx.styles.IStyleClient;
  38.    import mx.styles.StyleProxy;
  39.    
  40.    use namespace mx_internal;
  41.    
  42.    public class Panel extends Container implements IConstraintLayout, IFontContextComponent
  43.    {
  44.       mx_internal static var createAccessibilityImplementation:Function;
  45.       
  46.       mx_internal static const VERSION:String = "3.2.0.3958";
  47.       
  48.       private static const HEADER_PADDING:Number = 14;
  49.       
  50.       private static var _closeButtonStyleFilters:Object = {
  51.          "closeButtonUpSkin":"closeButtonUpSkin",
  52.          "closeButtonOverSkin":"closeButtonOverSkin",
  53.          "closeButtonDownSkin":"closeButtonDownSkin",
  54.          "closeButtonDisabledSkin":"closeButtonDisabledSkin",
  55.          "closeButtonSkin":"closeButtonSkin",
  56.          "repeatDelay":"repeatDelay",
  57.          "repeatInterval":"repeatInterval"
  58.       };
  59.       
  60.       private var layoutObject:Layout;
  61.       
  62.       private var _status:String = "";
  63.       
  64.       private var _titleChanged:Boolean = false;
  65.       
  66.       mx_internal var titleBarBackground:IFlexDisplayObject;
  67.       
  68.       private var regX:Number;
  69.       
  70.       private var regY:Number;
  71.       
  72.       private var _layout:String = "vertical";
  73.       
  74.       mx_internal var closeButton:Button;
  75.       
  76.       private var initializing:Boolean = true;
  77.       
  78.       private var _title:String = "";
  79.       
  80.       protected var titleTextField:IUITextField;
  81.       
  82.       private var _statusChanged:Boolean = false;
  83.       
  84.       private var autoSetRoundedCorners:Boolean;
  85.       
  86.       private var _titleIcon:Class;
  87.       
  88.       private var _constraintRows:Array;
  89.       
  90.       protected var controlBar:IUIComponent;
  91.       
  92.       mx_internal var titleIconObject:Object = null;
  93.       
  94.       protected var titleBar:UIComponent;
  95.       
  96.       private var panelViewMetrics:EdgeMetrics;
  97.       
  98.       private var _constraintColumns:Array;
  99.       
  100.       mx_internal var _showCloseButton:Boolean = false;
  101.       
  102.       private var checkedForAutoSetRoundedCorners:Boolean;
  103.       
  104.       private var _titleIconChanged:Boolean = false;
  105.       
  106.       protected var statusTextField:IUITextField;
  107.       
  108.       public function Panel()
  109.       {
  110.          _constraintColumns = [];
  111.          _constraintRows = [];
  112.          super();
  113.          addEventListener("resizeStart",EffectManager.mx_internal::eventHandler,false,EventPriority.EFFECT);
  114.          addEventListener("resizeEnd",EffectManager.mx_internal::eventHandler,false,EventPriority.EFFECT);
  115.          layoutObject = new BoxLayout();
  116.          layoutObject.target = this;
  117.          showInAutomationHierarchy = true;
  118.       }
  119.       
  120.       private function systemManager_mouseUpHandler(param1:MouseEvent) : void
  121.       {
  122.          if(!isNaN(regX))
  123.          {
  124.             stopDragging();
  125.          }
  126.       }
  127.       
  128.       mx_internal function getHeaderHeightProxy() : Number
  129.       {
  130.          return getHeaderHeight();
  131.       }
  132.       
  133.       override public function getChildIndex(param1:DisplayObject) : int
  134.       {
  135.          if(Boolean(controlBar) && param1 == controlBar)
  136.          {
  137.             return numChildren;
  138.          }
  139.          return super.getChildIndex(param1);
  140.       }
  141.       
  142.       mx_internal function get _controlBar() : IUIComponent
  143.       {
  144.          return controlBar;
  145.       }
  146.       
  147.       mx_internal function getTitleBar() : UIComponent
  148.       {
  149.          return titleBar;
  150.       }
  151.       
  152.       [Bindable("layoutChanged")]
  153.       public function get layout() : String
  154.       {
  155.          return _layout;
  156.       }
  157.       
  158.       override protected function createChildren() : void
  159.       {
  160.          var _loc1_:Class = null;
  161.          var _loc2_:IStyleClient = null;
  162.          var _loc3_:ISimpleStyleClient = null;
  163.          super.createChildren();
  164.          if(!titleBar)
  165.          {
  166.             titleBar = new UIComponent();
  167.             titleBar.visible = false;
  168.             titleBar.addEventListener(MouseEvent.MOUSE_DOWN,titleBar_mouseDownHandler);
  169.             rawChildren.addChild(titleBar);
  170.          }
  171.          if(!mx_internal::titleBarBackground)
  172.          {
  173.             _loc1_ = getStyle("titleBackgroundSkin");
  174.             if(_loc1_)
  175.             {
  176.                mx_internal::titleBarBackground = new _loc1_();
  177.                _loc2_ = mx_internal::titleBarBackground as IStyleClient;
  178.                if(_loc2_)
  179.                {
  180.                   _loc2_.setStyle("backgroundImage",undefined);
  181.                }
  182.                _loc3_ = mx_internal::titleBarBackground as ISimpleStyleClient;
  183.                if(_loc3_)
  184.                {
  185.                   _loc3_.styleName = this;
  186.                }
  187.                titleBar.addChild(DisplayObject(mx_internal::titleBarBackground));
  188.             }
  189.          }
  190.          mx_internal::createTitleTextField(-1);
  191.          mx_internal::createStatusTextField(-1);
  192.          if(!mx_internal::closeButton)
  193.          {
  194.             mx_internal::closeButton = new Button();
  195.             mx_internal::closeButton.styleName = new StyleProxy(this,closeButtonStyleFilters);
  196.             mx_internal::closeButton.mx_internal::upSkinName = "closeButtonUpSkin";
  197.             mx_internal::closeButton.mx_internal::overSkinName = "closeButtonOverSkin";
  198.             mx_internal::closeButton.mx_internal::downSkinName = "closeButtonDownSkin";
  199.             mx_internal::closeButton.mx_internal::disabledSkinName = "closeButtonDisabledSkin";
  200.             mx_internal::closeButton.mx_internal::skinName = "closeButtonSkin";
  201.             mx_internal::closeButton.explicitWidth = mx_internal::closeButton.explicitHeight = 16;
  202.             mx_internal::closeButton.focusEnabled = false;
  203.             mx_internal::closeButton.visible = false;
  204.             mx_internal::closeButton.enabled = enabled;
  205.             mx_internal::closeButton.addEventListener(MouseEvent.CLICK,closeButton_clickHandler);
  206.             titleBar.addChild(mx_internal::closeButton);
  207.             mx_internal::closeButton.owner = this;
  208.          }
  209.       }
  210.       
  211.       public function get constraintColumns() : Array
  212.       {
  213.          return _constraintColumns;
  214.       }
  215.       
  216.       override public function set cacheAsBitmap(param1:Boolean) : void
  217.       {
  218.          super.cacheAsBitmap = param1;
  219.          if(cacheAsBitmap && !mx_internal::contentPane && cachePolicy != UIComponentCachePolicy.OFF && getStyle("backgroundColor"))
  220.          {
  221.             mx_internal::createContentPane();
  222.             invalidateDisplayList();
  223.          }
  224.       }
  225.       
  226.       override public function createComponentsFromDescriptors(param1:Boolean = true) : void
  227.       {
  228.          var _loc3_:Object = null;
  229.          super.createComponentsFromDescriptors();
  230.          if(numChildren == 0)
  231.          {
  232.             setControlBar(null);
  233.             return;
  234.          }
  235.          var _loc2_:IUIComponent = IUIComponent(getChildAt(numChildren - 1));
  236.          if(_loc2_ is ControlBar)
  237.          {
  238.             _loc3_ = _loc2_.document;
  239.             if(mx_internal::contentPane)
  240.             {
  241.                mx_internal::contentPane.removeChild(DisplayObject(_loc2_));
  242.             }
  243.             else
  244.             {
  245.                removeChild(DisplayObject(_loc2_));
  246.             }
  247.             _loc2_.document = _loc3_;
  248.             rawChildren.addChild(DisplayObject(_loc2_));
  249.             setControlBar(_loc2_);
  250.          }
  251.          else
  252.          {
  253.             setControlBar(null);
  254.          }
  255.       }
  256.       
  257.       override protected function layoutChrome(param1:Number, param2:Number) : void
  258.       {
  259.          var _loc9_:Number = NaN;
  260.          var _loc10_:Graphics = null;
  261.          var _loc11_:Number = NaN;
  262.          var _loc12_:Number = NaN;
  263.          var _loc13_:Number = NaN;
  264.          var _loc14_:Number = NaN;
  265.          var _loc15_:Number = NaN;
  266.          var _loc16_:Number = NaN;
  267.          var _loc17_:Number = NaN;
  268.          var _loc18_:Number = NaN;
  269.          var _loc19_:Number = NaN;
  270.          var _loc20_:Number = NaN;
  271.          var _loc21_:Number = NaN;
  272.          super.layoutChrome(param1,param2);
  273.          var _loc3_:EdgeMetrics = EdgeMetrics.EMPTY;
  274.          var _loc4_:Number = getStyle("borderThickness");
  275.          if(getQualifiedClassName(mx_internal::border) == "mx.skins.halo::PanelSkin" && getStyle("borderStyle") != "default" && Boolean(_loc4_))
  276.          {
  277.             _loc3_ = new EdgeMetrics(_loc4_,_loc4_,_loc4_,_loc4_);
  278.          }
  279.          var _loc5_:EdgeMetrics = FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0 ? borderMetrics : _loc3_;
  280.          var _loc6_:Number = _loc5_.left;
  281.          var _loc7_:Number = _loc5_.top;
  282.          var _loc8_:Number = getHeaderHeight();
  283.          if(_loc8_ > 0 && height >= _loc8_)
  284.          {
  285.             _loc9_ = param1 - _loc5_.left - _loc5_.right;
  286.             showTitleBar(true);
  287.             titleBar.mouseChildren = true;
  288.             titleBar.mouseEnabled = true;
  289.             _loc10_ = titleBar.graphics;
  290.             _loc10_.clear();
  291.             _loc10_.beginFill(16777215,0);
  292.             _loc10_.drawRect(0,0,_loc9_,_loc8_);
  293.             _loc10_.endFill();
  294.             titleBar.move(_loc6_,_loc7_);
  295.             titleBar.setActualSize(_loc9_,_loc8_);
  296.             mx_internal::titleBarBackground.move(0,0);
  297.             IFlexDisplayObject(mx_internal::titleBarBackground).setActualSize(_loc9_,_loc8_);
  298.             mx_internal::closeButton.visible = mx_internal::_showCloseButton;
  299.             if(mx_internal::_showCloseButton)
  300.             {
  301.                mx_internal::closeButton.setActualSize(mx_internal::closeButton.getExplicitOrMeasuredWidth(),mx_internal::closeButton.getExplicitOrMeasuredHeight());
  302.                mx_internal::closeButton.move(param1 - _loc6_ - _loc5_.right - 10 - mx_internal::closeButton.getExplicitOrMeasuredWidth(),(_loc8_ - mx_internal::closeButton.getExplicitOrMeasuredHeight()) / 2);
  303.             }
  304.             _loc11_ = 10;
  305.             _loc12_ = 10;
  306.             if(mx_internal::titleIconObject)
  307.             {
  308.                _loc13_ = Number(mx_internal::titleIconObject.height);
  309.                _loc14_ = (_loc8_ - _loc13_) / 2;
  310.                mx_internal::titleIconObject.move(_loc11_,_loc14_);
  311.                _loc11_ += mx_internal::titleIconObject.width + 4;
  312.             }
  313.             if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  314.             {
  315.                _loc13_ = titleTextField.nonZeroTextHeight;
  316.             }
  317.             else
  318.             {
  319.                _loc13_ = titleTextField.getUITextFormat().measureText(titleTextField.text).height;
  320.             }
  321.             _loc14_ = (_loc8_ - _loc13_) / 2;
  322.             _loc15_ = _loc5_.left + _loc5_.right;
  323.             titleTextField.move(_loc11_,_loc14_ - 1);
  324.             titleTextField.setActualSize(Math.max(0,param1 - _loc11_ - _loc12_ - _loc15_),_loc13_ + UITextField.mx_internal::TEXT_HEIGHT_PADDING);
  325.             if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  326.             {
  327.                _loc13_ = statusTextField.textHeight;
  328.             }
  329.             else
  330.             {
  331.                _loc13_ = statusTextField.text != "" ? statusTextField.getUITextFormat().measureText(statusTextField.text).height : 0;
  332.             }
  333.             _loc14_ = (_loc8_ - _loc13_) / 2;
  334.             _loc16_ = param1 - _loc12_ - 4 - _loc15_ - statusTextField.textWidth;
  335.             if(mx_internal::_showCloseButton)
  336.             {
  337.                _loc16_ -= mx_internal::closeButton.getExplicitOrMeasuredWidth() + 4;
  338.             }
  339.             statusTextField.move(_loc16_,_loc14_ - 1);
  340.             statusTextField.setActualSize(statusTextField.textWidth + 8,statusTextField.textHeight + UITextField.mx_internal::TEXT_HEIGHT_PADDING);
  341.             _loc17_ = titleTextField.x + titleTextField.textWidth + 8;
  342.             if(statusTextField.x < _loc17_)
  343.             {
  344.                statusTextField.width = Math.max(statusTextField.width - (_loc17_ - statusTextField.x),0);
  345.                statusTextField.x = _loc17_;
  346.             }
  347.          }
  348.          else if(titleBar)
  349.          {
  350.             showTitleBar(false);
  351.             titleBar.mouseChildren = false;
  352.             titleBar.mouseEnabled = false;
  353.          }
  354.          if(controlBar)
  355.          {
  356.             _loc18_ = Number(controlBar.x);
  357.             _loc19_ = Number(controlBar.y);
  358.             _loc20_ = Number(controlBar.width);
  359.             _loc21_ = Number(controlBar.height);
  360.             controlBar.setActualSize(param1 - (_loc5_.left + _loc5_.right),controlBar.getExplicitOrMeasuredHeight());
  361.             controlBar.move(_loc5_.left,param2 - _loc5_.bottom - controlBar.getExplicitOrMeasuredHeight());
  362.             if(controlBar.includeInLayout)
  363.             {
  364.                controlBar.visible = controlBar.y >= _loc5_.top;
  365.             }
  366.             if(_loc18_ != controlBar.x || _loc19_ != controlBar.y || _loc20_ != controlBar.width || _loc21_ != controlBar.height)
  367.             {
  368.                invalidateDisplayList();
  369.             }
  370.          }
  371.       }
  372.       
  373.       public function set layout(param1:String) : void
  374.       {
  375.          if(_layout != param1)
  376.          {
  377.             _layout = param1;
  378.             if(layoutObject)
  379.             {
  380.                layoutObject.target = null;
  381.             }
  382.             if(_layout == ContainerLayout.ABSOLUTE)
  383.             {
  384.                layoutObject = new CanvasLayout();
  385.             }
  386.             else
  387.             {
  388.                layoutObject = new BoxLayout();
  389.                if(_layout == ContainerLayout.VERTICAL)
  390.                {
  391.                   BoxLayout(layoutObject).direction = BoxDirection.VERTICAL;
  392.                }
  393.                else
  394.                {
  395.                   BoxLayout(layoutObject).direction = BoxDirection.HORIZONTAL;
  396.                }
  397.             }
  398.             if(layoutObject)
  399.             {
  400.                layoutObject.target = this;
  401.             }
  402.             invalidateSize();
  403.             invalidateDisplayList();
  404.             dispatchEvent(new Event("layoutChanged"));
  405.          }
  406.       }
  407.       
  408.       public function get constraintRows() : Array
  409.       {
  410.          return _constraintRows;
  411.       }
  412.       
  413.       [Bindable("titleChanged")]
  414.       public function get title() : String
  415.       {
  416.          return _title;
  417.       }
  418.       
  419.       mx_internal function getTitleTextField() : IUITextField
  420.       {
  421.          return titleTextField;
  422.       }
  423.       
  424.       mx_internal function createStatusTextField(param1:int) : void
  425.       {
  426.          var _loc2_:String = null;
  427.          if(Boolean(titleBar) && !statusTextField)
  428.          {
  429.             statusTextField = IUITextField(createInFontContext(UITextField));
  430.             statusTextField.selectable = false;
  431.             if(param1 == -1)
  432.             {
  433.                titleBar.addChild(DisplayObject(statusTextField));
  434.             }
  435.             else
  436.             {
  437.                titleBar.addChildAt(DisplayObject(statusTextField),param1);
  438.             }
  439.             _loc2_ = getStyle("statusStyleName");
  440.             statusTextField.styleName = _loc2_;
  441.             statusTextField.text = status;
  442.             statusTextField.enabled = enabled;
  443.          }
  444.       }
  445.       
  446.       public function get fontContext() : IFlexModuleFactory
  447.       {
  448.          return moduleFactory;
  449.       }
  450.       
  451.       override protected function measure() : void
  452.       {
  453.          var _loc6_:Number = NaN;
  454.          super.measure();
  455.          layoutObject.measure();
  456.          var _loc1_:Rectangle = measureHeaderText();
  457.          var _loc2_:Number = _loc1_.width;
  458.          var _loc3_:Number = _loc1_.height;
  459.          var _loc4_:EdgeMetrics = FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0 ? borderMetrics : EdgeMetrics.EMPTY;
  460.          _loc2_ += _loc4_.left + _loc4_.right;
  461.          var _loc5_:Number = 5;
  462.          _loc2_ += _loc5_ * 2;
  463.          if(mx_internal::titleIconObject)
  464.          {
  465.             _loc2_ += mx_internal::titleIconObject.width;
  466.          }
  467.          if(mx_internal::closeButton)
  468.          {
  469.             _loc2_ += mx_internal::closeButton.getExplicitOrMeasuredWidth() + 6;
  470.          }
  471.          measuredMinWidth = Math.max(_loc2_,measuredMinWidth);
  472.          measuredWidth = Math.max(_loc2_,measuredWidth);
  473.          if(Boolean(controlBar) && Boolean(controlBar.includeInLayout))
  474.          {
  475.             _loc6_ = controlBar.getExplicitOrMeasuredWidth() + _loc4_.left + _loc4_.right;
  476.             measuredWidth = Math.max(measuredWidth,_loc6_);
  477.          }
  478.       }
  479.       
  480.       mx_internal function getControlBar() : IUIComponent
  481.       {
  482.          return controlBar;
  483.       }
  484.       
  485.       override public function get viewMetrics() : EdgeMetrics
  486.       {
  487.          var _loc2_:EdgeMetrics = null;
  488.          var _loc3_:Number = NaN;
  489.          var _loc4_:Number = NaN;
  490.          var _loc5_:Number = NaN;
  491.          var _loc6_:Number = NaN;
  492.          var _loc7_:Number = NaN;
  493.          var _loc8_:Number = NaN;
  494.          var _loc1_:EdgeMetrics = super.viewMetrics;
  495.          if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  496.          {
  497.             if(!panelViewMetrics)
  498.             {
  499.                panelViewMetrics = new EdgeMetrics(0,0,0,0);
  500.             }
  501.             _loc1_ = panelViewMetrics;
  502.             _loc2_ = super.viewMetrics;
  503.             _loc3_ = getStyle("borderThickness");
  504.             _loc4_ = getStyle("borderThicknessLeft");
  505.             _loc5_ = getStyle("borderThicknessTop");
  506.             _loc6_ = getStyle("borderThicknessRight");
  507.             _loc7_ = getStyle("borderThicknessBottom");
  508.             _loc1_.left = _loc2_.left + (isNaN(_loc4_) ? _loc3_ : _loc4_);
  509.             _loc1_.top = _loc2_.top + (isNaN(_loc5_) ? _loc3_ : _loc5_);
  510.             _loc1_.right = _loc2_.right + (isNaN(_loc6_) ? _loc3_ : _loc6_);
  511.             _loc1_.bottom = _loc2_.bottom + (isNaN(_loc7_) ? (Boolean(controlBar) && !isNaN(_loc5_) ? _loc5_ : (isNaN(_loc4_) ? _loc3_ : _loc4_)) : _loc7_);
  512.             _loc8_ = getHeaderHeight();
  513.             if(!isNaN(_loc8_))
  514.             {
  515.                _loc1_.top += _loc8_;
  516.             }
  517.             if(Boolean(controlBar) && Boolean(controlBar.includeInLayout))
  518.             {
  519.                _loc1_.bottom += controlBar.getExplicitOrMeasuredHeight();
  520.             }
  521.          }
  522.          return _loc1_;
  523.       }
  524.       
  525.       private function measureHeaderText() : Rectangle
  526.       {
  527.          var _loc3_:UITextFormat = null;
  528.          var _loc4_:TextLineMetrics = null;
  529.          var _loc1_:Number = 20;
  530.          var _loc2_:Number = 14;
  531.          if(Boolean(titleTextField) && Boolean(titleTextField.text))
  532.          {
  533.             titleTextField.validateNow();
  534.             _loc3_ = titleTextField.getUITextFormat();
  535.             _loc4_ = _loc3_.measureText(titleTextField.text,false);
  536.             _loc1_ = _loc4_.width;
  537.             _loc2_ = _loc4_.height;
  538.          }
  539.          if(Boolean(statusTextField) && Boolean(statusTextField.text))
  540.          {
  541.             statusTextField.validateNow();
  542.             _loc3_ = statusTextField.getUITextFormat();
  543.             _loc4_ = _loc3_.measureText(statusTextField.text,false);
  544.             _loc1_ = Math.max(_loc1_,_loc4_.width);
  545.             _loc2_ = Math.max(_loc2_,_loc4_.height);
  546.          }
  547.          return new Rectangle(0,0,Math.round(_loc1_),Math.round(_loc2_));
  548.       }
  549.       
  550.       mx_internal function createTitleTextField(param1:int) : void
  551.       {
  552.          var _loc2_:String = null;
  553.          if(!titleTextField)
  554.          {
  555.             titleTextField = IUITextField(createInFontContext(UITextField));
  556.             titleTextField.selectable = false;
  557.             if(param1 == -1)
  558.             {
  559.                titleBar.addChild(DisplayObject(titleTextField));
  560.             }
  561.             else
  562.             {
  563.                titleBar.addChildAt(DisplayObject(titleTextField),param1);
  564.             }
  565.             _loc2_ = getStyle("titleStyleName");
  566.             titleTextField.styleName = _loc2_;
  567.             titleTextField.text = title;
  568.             titleTextField.enabled = enabled;
  569.          }
  570.       }
  571.       
  572.       private function closeButton_clickHandler(param1:MouseEvent) : void
  573.       {
  574.          dispatchEvent(new CloseEvent(CloseEvent.CLOSE));
  575.       }
  576.       
  577.       private function setControlBar(param1:IUIComponent) : void
  578.       {
  579.          if(param1 == controlBar)
  580.          {
  581.             return;
  582.          }
  583.          controlBar = param1;
  584.          if(!checkedForAutoSetRoundedCorners)
  585.          {
  586.             checkedForAutoSetRoundedCorners = true;
  587.             autoSetRoundedCorners = !!styleDeclaration ? styleDeclaration.getStyle("roundedBottomCorners") === undefined : true;
  588.          }
  589.          if(autoSetRoundedCorners)
  590.          {
  591.             setStyle("roundedBottomCorners",controlBar != null);
  592.          }
  593.          var _loc2_:String = getStyle("controlBarStyleName");
  594.          if(Boolean(_loc2_) && controlBar is ISimpleStyleClient)
  595.          {
  596.             ISimpleStyleClient(controlBar).styleName = _loc2_;
  597.          }
  598.          if(controlBar)
  599.          {
  600.             controlBar.enabled = enabled;
  601.          }
  602.          if(controlBar is IAutomationObject)
  603.          {
  604.             IAutomationObject(controlBar).showInAutomationHierarchy = false;
  605.          }
  606.          mx_internal::invalidateViewMetricsAndPadding();
  607.          invalidateSize();
  608.          invalidateDisplayList();
  609.       }
  610.       
  611.       protected function get closeButtonStyleFilters() : Object
  612.       {
  613.          return _closeButtonStyleFilters;
  614.       }
  615.       
  616.       public function set constraintColumns(param1:Array) : void
  617.       {
  618.          var _loc2_:int = 0;
  619.          var _loc3_:int = 0;
  620.          if(param1 != _constraintColumns)
  621.          {
  622.             _loc2_ = int(param1.length);
  623.             _loc3_ = 0;
  624.             while(_loc3_ < _loc2_)
  625.             {
  626.                ConstraintColumn(param1[_loc3_]).container = this;
  627.                _loc3_++;
  628.             }
  629.             _constraintColumns = param1;
  630.             invalidateSize();
  631.             invalidateDisplayList();
  632.          }
  633.       }
  634.       
  635.       override public function set enabled(param1:Boolean) : void
  636.       {
  637.          super.enabled = param1;
  638.          if(titleTextField)
  639.          {
  640.             titleTextField.enabled = param1;
  641.          }
  642.          if(statusTextField)
  643.          {
  644.             statusTextField.enabled = param1;
  645.          }
  646.          if(controlBar)
  647.          {
  648.             controlBar.enabled = param1;
  649.          }
  650.          if(mx_internal::closeButton)
  651.          {
  652.             mx_internal::closeButton.enabled = param1;
  653.          }
  654.       }
  655.       
  656.       override public function get baselinePosition() : Number
  657.       {
  658.          if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  659.          {
  660.             return super.baselinePosition;
  661.          }
  662.          if(!mx_internal::validateBaselinePosition())
  663.          {
  664.             return NaN;
  665.          }
  666.          return titleBar.y + titleTextField.y + titleTextField.baselinePosition;
  667.       }
  668.       
  669.       protected function stopDragging() : void
  670.       {
  671.          var _loc1_:DisplayObject = systemManager.getSandboxRoot();
  672.          _loc1_.removeEventListener(MouseEvent.MOUSE_MOVE,systemManager_mouseMoveHandler,true);
  673.          _loc1_.removeEventListener(MouseEvent.MOUSE_UP,systemManager_mouseUpHandler,true);
  674.          _loc1_.removeEventListener(SandboxMouseEvent.MOUSE_UP_SOMEWHERE,stage_mouseLeaveHandler);
  675.          regX = NaN;
  676.          regY = NaN;
  677.          systemManager.deployMouseShields(false);
  678.       }
  679.       
  680.       private function titleBar_mouseDownHandler(param1:MouseEvent) : void
  681.       {
  682.          if(param1.target == mx_internal::closeButton)
  683.          {
  684.             return;
  685.          }
  686.          if(enabled && isPopUp && isNaN(regX))
  687.          {
  688.             startDragging(param1);
  689.          }
  690.       }
  691.       
  692.       override mx_internal function get usePadding() : Boolean
  693.       {
  694.          return layout != ContainerLayout.ABSOLUTE;
  695.       }
  696.       
  697.       override protected function initializeAccessibility() : void
  698.       {
  699.          if(Panel.mx_internal::createAccessibilityImplementation != null)
  700.          {
  701.             Panel.mx_internal::createAccessibilityImplementation(this);
  702.          }
  703.       }
  704.       
  705.       protected function getHeaderHeight() : Number
  706.       {
  707.          var _loc1_:Number = getStyle("headerHeight");
  708.          if(isNaN(_loc1_))
  709.          {
  710.             _loc1_ = measureHeaderText().height + HEADER_PADDING;
  711.          }
  712.          return _loc1_;
  713.       }
  714.       
  715.       public function set constraintRows(param1:Array) : void
  716.       {
  717.          var _loc2_:int = 0;
  718.          var _loc3_:int = 0;
  719.          if(param1 != _constraintRows)
  720.          {
  721.             _loc2_ = int(param1.length);
  722.             _loc3_ = 0;
  723.             while(_loc3_ < _loc2_)
  724.             {
  725.                ConstraintRow(param1[_loc3_]).container = this;
  726.                _loc3_++;
  727.             }
  728.             _constraintRows = param1;
  729.             invalidateSize();
  730.             invalidateDisplayList();
  731.          }
  732.       }
  733.       
  734.       public function set title(param1:String) : void
  735.       {
  736.          _title = param1;
  737.          _titleChanged = true;
  738.          invalidateProperties();
  739.          invalidateSize();
  740.          mx_internal::invalidateViewMetricsAndPadding();
  741.          dispatchEvent(new Event("titleChanged"));
  742.       }
  743.       
  744.       private function showTitleBar(param1:Boolean) : void
  745.       {
  746.          var _loc4_:DisplayObject = null;
  747.          titleBar.visible = param1;
  748.          var _loc2_:int = titleBar.numChildren;
  749.          var _loc3_:int = 0;
  750.          while(_loc3_ < _loc2_)
  751.          {
  752.             _loc4_ = titleBar.getChildAt(_loc3_);
  753.             _loc4_.visible = param1;
  754.             _loc3_++;
  755.          }
  756.       }
  757.       
  758.       override public function styleChanged(param1:String) : void
  759.       {
  760.          var _loc3_:String = null;
  761.          var _loc4_:String = null;
  762.          var _loc5_:String = null;
  763.          var _loc6_:Class = null;
  764.          var _loc7_:IStyleClient = null;
  765.          var _loc8_:ISimpleStyleClient = null;
  766.          var _loc2_:Boolean = !param1 || param1 == "styleName";
  767.          super.styleChanged(param1);
  768.          if(_loc2_ || param1 == "titleStyleName")
  769.          {
  770.             if(titleTextField)
  771.             {
  772.                _loc3_ = getStyle("titleStyleName");
  773.                titleTextField.styleName = _loc3_;
  774.             }
  775.          }
  776.          if(_loc2_ || param1 == "statusStyleName")
  777.          {
  778.             if(statusTextField)
  779.             {
  780.                _loc4_ = getStyle("statusStyleName");
  781.                statusTextField.styleName = _loc4_;
  782.             }
  783.          }
  784.          if(_loc2_ || param1 == "controlBarStyleName")
  785.          {
  786.             if(Boolean(controlBar) && controlBar is ISimpleStyleClient)
  787.             {
  788.                _loc5_ = getStyle("controlBarStyleName");
  789.                ISimpleStyleClient(controlBar).styleName = _loc5_;
  790.             }
  791.          }
  792.          if(_loc2_ || param1 == "titleBackgroundSkin")
  793.          {
  794.             if(titleBar)
  795.             {
  796.                _loc6_ = getStyle("titleBackgroundSkin");
  797.                if(_loc6_)
  798.                {
  799.                   if(mx_internal::titleBarBackground)
  800.                   {
  801.                      titleBar.removeChild(DisplayObject(mx_internal::titleBarBackground));
  802.                      mx_internal::titleBarBackground = null;
  803.                   }
  804.                   mx_internal::titleBarBackground = new _loc6_();
  805.                   _loc7_ = mx_internal::titleBarBackground as IStyleClient;
  806.                   if(_loc7_)
  807.                   {
  808.                      _loc7_.setStyle("backgroundImage",undefined);
  809.                   }
  810.                   _loc8_ = mx_internal::titleBarBackground as ISimpleStyleClient;
  811.                   if(_loc8_)
  812.                   {
  813.                      _loc8_.styleName = this;
  814.                   }
  815.                   titleBar.addChildAt(DisplayObject(mx_internal::titleBarBackground),0);
  816.                }
  817.             }
  818.          }
  819.       }
  820.       
  821.       mx_internal function getStatusTextField() : IUITextField
  822.       {
  823.          return statusTextField;
  824.       }
  825.       
  826.       public function set fontContext(param1:IFlexModuleFactory) : void
  827.       {
  828.          this.moduleFactory = param1;
  829.       }
  830.       
  831.       override protected function commitProperties() : void
  832.       {
  833.          var _loc1_:int = 0;
  834.          super.commitProperties();
  835.          if(hasFontContextChanged())
  836.          {
  837.             if(titleTextField)
  838.             {
  839.                _loc1_ = titleBar.getChildIndex(DisplayObject(titleTextField));
  840.                mx_internal::removeTitleTextField();
  841.                mx_internal::createTitleTextField(_loc1_);
  842.                _titleChanged = true;
  843.             }
  844.             if(statusTextField)
  845.             {
  846.                _loc1_ = titleBar.getChildIndex(DisplayObject(statusTextField));
  847.                mx_internal::removeStatusTextField();
  848.                mx_internal::createStatusTextField(_loc1_);
  849.                _statusChanged = true;
  850.             }
  851.          }
  852.          if(_titleChanged)
  853.          {
  854.             _titleChanged = false;
  855.             titleTextField.text = _title;
  856.             if(initialized)
  857.             {
  858.                layoutChrome(unscaledWidth,unscaledHeight);
  859.             }
  860.          }
  861.          if(_titleIconChanged)
  862.          {
  863.             _titleIconChanged = false;
  864.             if(mx_internal::titleIconObject)
  865.             {
  866.                titleBar.removeChild(DisplayObject(mx_internal::titleIconObject));
  867.                mx_internal::titleIconObject = null;
  868.             }
  869.             if(_titleIcon)
  870.             {
  871.                mx_internal::titleIconObject = new _titleIcon();
  872.                titleBar.addChild(DisplayObject(mx_internal::titleIconObject));
  873.             }
  874.             if(initialized)
  875.             {
  876.                layoutChrome(unscaledWidth,unscaledHeight);
  877.             }
  878.          }
  879.          if(_statusChanged)
  880.          {
  881.             _statusChanged = false;
  882.             statusTextField.text = _status;
  883.             if(initialized)
  884.             {
  885.                layoutChrome(unscaledWidth,unscaledHeight);
  886.             }
  887.          }
  888.       }
  889.       
  890.       protected function startDragging(param1:MouseEvent) : void
  891.       {
  892.          regX = param1.stageX - x;
  893.          regY = param1.stageY - y;
  894.          var _loc2_:DisplayObject = systemManager.getSandboxRoot();
  895.          _loc2_.addEventListener(MouseEvent.MOUSE_MOVE,systemManager_mouseMoveHandler,true);
  896.          _loc2_.addEventListener(MouseEvent.MOUSE_UP,systemManager_mouseUpHandler,true);
  897.          _loc2_.addEventListener(SandboxMouseEvent.MOUSE_UP_SOMEWHERE,stage_mouseLeaveHandler);
  898.          systemManager.deployMouseShields(true);
  899.       }
  900.       
  901.       mx_internal function removeStatusTextField() : void
  902.       {
  903.          if(Boolean(titleBar) && Boolean(statusTextField))
  904.          {
  905.             titleBar.removeChild(DisplayObject(statusTextField));
  906.             statusTextField = null;
  907.          }
  908.       }
  909.       
  910.       private function stage_mouseLeaveHandler(param1:Event) : void
  911.       {
  912.          if(!isNaN(regX))
  913.          {
  914.             stopDragging();
  915.          }
  916.       }
  917.       
  918.       public function set status(param1:String) : void
  919.       {
  920.          _status = param1;
  921.          _statusChanged = true;
  922.          invalidateProperties();
  923.          dispatchEvent(new Event("statusChanged"));
  924.       }
  925.       
  926.       [Bindable("titleIconChanged")]
  927.       public function get titleIcon() : Class
  928.       {
  929.          return _titleIcon;
  930.       }
  931.       
  932.       [Bindable("statusChanged")]
  933.       public function get status() : String
  934.       {
  935.          return _status;
  936.       }
  937.       
  938.       private function systemManager_mouseMoveHandler(param1:MouseEvent) : void
  939.       {
  940.          param1.stopImmediatePropagation();
  941.          if(isNaN(regX) || isNaN(regY))
  942.          {
  943.             return;
  944.          }
  945.          move(param1.stageX - regX,param1.stageY - regY);
  946.       }
  947.       
  948.       override protected function updateDisplayList(param1:Number, param2:Number) : void
  949.       {
  950.          super.updateDisplayList(param1,param2);
  951.          layoutObject.updateDisplayList(param1,param2);
  952.          if(mx_internal::border)
  953.          {
  954.             mx_internal::border.visible = true;
  955.          }
  956.          titleBar.visible = true;
  957.       }
  958.       
  959.       mx_internal function removeTitleTextField() : void
  960.       {
  961.          if(Boolean(titleBar) && Boolean(titleTextField))
  962.          {
  963.             titleBar.removeChild(DisplayObject(titleTextField));
  964.             titleTextField = null;
  965.          }
  966.       }
  967.       
  968.       public function set titleIcon(param1:Class) : void
  969.       {
  970.          _titleIcon = param1;
  971.          _titleIconChanged = true;
  972.          invalidateProperties();
  973.          invalidateSize();
  974.          dispatchEvent(new Event("titleIconChanged"));
  975.       }
  976.    }
  977. }
  978.  
  979.